package com.cskaoyan;

import com.cskaoyan.bean.Account;
import com.cskaoyan.mapper.UserMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * 创建日期: 2022/05/19 11:13
 *
 * @author ciggar
 */
public class MybatisDemo {

    public static void main(String[] args) throws IOException {

        // 获取接口的实例对象
//        UserMapper userMapper = new UserMapperImpl();

        SqlSession sqlSession = MybatisUtils.getSqlSession();

        // 通过Mybatis 获取UserMapper这个接口的代理对象(MapperProxy)
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);

        // 调用方法
        Account account = userMapper.selectAccountById(4);

        System.out.println(account);


    }

}
